from .metric import MetricConnection, METRIC_SETTINGS
from datetime import datetime, timedelta


def export_metric_data(start_time, end_time):
    metric_conn = MetricConnection(METRIC_SETTINGS)
    print("success...")

    # end_time = datetime.now()
    # start_time = end_time - timedelta(minutes=5)
    try:
        metric_conn.export_all_metrics(
            start_time, end_time, "/JumpStarter/data/metric_data/"
        )
    except Exception as e:
        print(e)
